package cn.itcast.controller;

import cn.itcast.constant.MessageConstant;
import cn.itcast.entity.Result;
import cn.itcast.mobile.MobileMemberService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Demo class
 *
 * @author gyc
 * @date 2021 /10/17
 */
@RestController
@RequestMapping("/sms")
public class SmsController {
    @Reference
    private MobileMemberService memberService;

    /**
     * Send login code result.
     *
     * @param phone the phone
     * @return the result
     */
    @PostMapping("/sendLoginCode")
    public Result sendLoginCode(@RequestParam String phone){
        //返回数据
        boolean result = memberService.sendCode(phone);
        return new Result(result, MessageConstant.SEND_VALIDATECODE_SUCCESS);
    }
    @PostMapping("/sendCode")
    public Result sendCode(@RequestParam String phone){
        //返回数据
        boolean result = memberService.sendCode(phone);
        return new Result(result,MessageConstant.SEND_VALIDATECODE_SUCCESS);
    }
}
